def letters(str):
    if str=="":
        return str
    else:
        newstr=''
        for i in str:
            if i.isalpha():
                newstr +=i
        return newstr


def reverse(str):
    l = list(str)
    new_string = ""
    while len(l) > 0:
        new_string += l.pop()
    return new_string

str=input("请输入一个字符串:")
newstr=letters(str)
print("字符串反转输出：{}".format(reverse(newstr)))
